/**
 * Copyright 2009-2010 - YangJiandong(chunquedong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 你可以自由复制、传播本项目的下载包文件，但必须保持其完整性。
 * 我们不用对使用中的风险及由此造成的损失承担任何责任。
 * 详细情况请见《ChunMap许可协议》。

 * 想了解更多有关ChunMap的信息，请访问http://code.google.com/p/chunmap/
 */
package chunmap.example.overlay;

import java.util.List;

import chunmap.example.BaseGeometryMap;
import chunmap.model.geom.Geometry;
import chunmap.model.geom.Polygon;
import chunmap.model.geom.WktReader;
import chunmap.model.operate.overlay.OverLayOp;

/**
 * @author chunquedong
 * 
 */
public class UnionTest extends BaseGeometryMap {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		UnionTest me = new UnionTest();
		me.init();
	}

	@Override
	protected void addGeometry(List<Geometry> geoms) {
		WktReader wkt = new WktReader();
		Geometry g = wkt
				.read("Polygon(1.0 6.0,5.999998414659173 1.0039816335536662,1.0079632645824341 -3.999993658637697,-3.9999857319385903 0.9880551094385923,1.0 6.0)");
		Polygon ls = (Polygon) g;
		Geometry g2 = wkt
				.read("Polygon(-2.639991350383829 -1.7999950537374092,-1.8399918576928131 -1.7999950537374092,-1.8399918576928131 -0.9999955610463935,-2.639991350383829 -0.9999955610463935,-2.639991350383829 -1.7999950537374092)");
		Polygon ls2 = (Polygon) g2;

		OverLayOp op = new OverLayOp();
		Polygon pg = op.computeUnion(ls, ls2).getGeometry(0);
		geoms.add(pg);

		// geoms.add(ls);
		// geoms.add(ls2);
	}
}
